home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / gladiatr.c < prev    next >
C/C++ Source or Header  |  2000-05-04  |  24KB  |  718 lines

  1. /*
  2. Taito Gladiator (1986)
  3. Known ROM SETS: Golden Castle, Ohgon no Siro
  4.  
  5. Credits:
  6. - Victor Trucco: original emulation and MAME driver
  7. - Steve Ellenoff: YM2203 Sound, ADPCM Sound, dip switch fixes, high score save,
  8.           input port patches, panning fix, sprite banking,
  9.           Golden Castle Rom Set Support
  10. - Phil Stroffolino: palette, sprites, misc video driver fixes
  11. - Tatsuyuki Satoh: YM2203 sound improvements, NEC 8741 simulation,ADPCM with MC6809
  12.  
  13. special thanks to:
  14. - Camilty for precious hardware information and screenshots
  15. - Jason Richmond for hardware information and misc. notes
  16. - Joe Rounceville for schematics
  17. - and everyone else who'se offered support along the way!
  18.  
  19. Issues:
  20. - YM2203 mixing problems (loss of bass notes)
  21. - YM2203 some sound effects just don't sound correct
  22. - Audio Filter Switch not hooked up (might solve YM2203 mixing issue)
  23. - Ports 60,61,80,81 not fully understood yet...
  24. - CPU speed may not be accurate
  25. - some sprites linger on later stages (perhaps a sprite enable bit?)
  26. - Flipscreen not implemented
  27. - Scrolling issues in Test mode!
  28. - The four 8741 ROMs are available but not used.
  29.  
  30. Preliminary Gladiator Memory Map
  31.  
  32. Main CPU (Z80)
  33.  
  34. $0000-$3FFF    QB0-5
  35. $4000-$5FFF    QB0-4
  36.  
  37. $6000-$7FFF    QB0-1 Paged
  38. $8000-$BFFF    QC0-3 Paged
  39.  
  40.     if port 02 = 00     QB0-1 offset (0000-1fff) at location 6000-7fff
  41.                         QC0-3 offset (0000-3fff) at location 8000-bfff
  42.  
  43.     if port 02 = 01     QB0-1 offset (2000-3fff) at location 6000-7fff
  44.                         QC0-3 offset (4000-7fff) at location 8000-bfff
  45.  
  46. $C000-$C3FF    sprite RAM
  47. $C400-$C7FF    sprite attributes
  48. $C800-$CBFF    more sprite attributes
  49.  
  50. $CC00-$D7FF    video registers
  51.  
  52. (scrolling, 2 screens wide)
  53. $D800-DFFF    background layer VRAM (tiles)
  54. $E000-E7FF    background layer VRAM (attributes)
  55. $E800-EFFF    foreground text layer VRAM
  56.  
  57. $F000-$F3FF    Battery Backed RAM
  58. $F400-$F7FF    Work RAM
  59.  
  60. Audio CPU (Z80)
  61. $0000-$3FFF    QB0-17
  62. $8000-$83FF    Work RAM 2.CPU
  63.  
  64.  
  65. Preliminary Descriptions of I/O Ports.
  66.  
  67. Main z80
  68. 8 pins of LS259:
  69.   00 - OBJACS ? (I can't read the name in schematics)
  70.   01 - OBJCGBK (Sprite banking)
  71.   02 - PR.BK (ROM banking)
  72.   03 - NMIFG (connects to NMI of main Z80, but there's no code in 0066)
  73.   04 - SRST (probably some type of reset)
  74.   05 - CBK0 (unknown)
  75.   06 - LOBJ (connected near graphic ROMs)
  76.   07 - REVERS
  77.   9E - Send data to NEC 8741-0 (comunicate with 2nd z80)
  78.         (dip switch 1 is read in these ports too)
  79.   9F - Send commands to NEC 8741-0
  80.  
  81.   C0-DF 8251 (Debug port ?)
  82.  
  83. 2nd z80
  84.  
  85. 00 - YM2203 Control Reg.
  86. 01 - YM2203 Data Read / Write Reg.
  87.         Port B of the YM2203 is connected to dip switch 3
  88. 20 - Send data to NEC 8741-1 (comunicate with Main z80)
  89.         (dip switch 2 is read in these ports too)
  90. 21 - Send commands to NEC 8741-1 (comunicate with Main z80)
  91. 40 - Clear Interrupt latch
  92. 60 - Send data to NEC 8741-2 (Read Joystick and Coin Slot (both players)
  93. 61 - Send commands to NEC 8741-2
  94. 80 - Send data to NEC 8741-3 (Read buttons (Fire 1, 2 and 3 (both players), service button) )
  95. 81 - Send commands to NEC 8741-3
  96.  
  97. A0-BF  - Audio mixer control ?
  98. E0     - Comunication port to 6809
  99. */
  100.  
  101. #include "driver.h"
  102. #include "vidhrdw/generic.h"
  103. #include "machine/tait8741.h"
  104. #include "cpu/z80/z80.h"
  105.  
  106. /*Video functions*/
  107. extern unsigned char *gladiator_text;
  108. WRITE_HANDLER( gladiatr_video_registers_w );
  109. READ_HANDLER( gladiatr_video_registers_r );
  110. WRITE_HANDLER( gladiatr_paletteram_rg_w );
  111. WRITE_HANDLER( gladiatr_paletteram_b_w );
  112. extern int gladiatr_vh_start(void);
  113. extern void gladiatr_vh_stop(void);
  114. extern void gladiatr_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  115. WRITE_HANDLER( gladiatr_spritebank_w );
  116.  
  117. /*Rom bankswitching*/
  118. static int banka;
  119. WRITE_HANDLER( gladiatr_bankswitch_w );
  120. READ_HANDLER( gladiatr_bankswitch_r );
  121.  
  122. /*Rom bankswitching*/
  123. WRITE_HANDLER( gladiatr_bankswitch_w ){
  124.     static int bank1[2] = { 0x10000, 0x12000 };
  125.     static int bank2[2] = { 0x14000, 0x18000 };
  126.     unsigned char *RAM = memory_region(REGION_CPU1);
  127.     banka = data;
  128.     cpu_setbank(1,&RAM[bank1[(data & 0x03)]]);
  129.     cpu_setbank(2,&RAM[bank2[(data & 0x03)]]);
  130. }
  131.  
  132. READ_HANDLER( gladiatr_bankswitch_r ){
  133.     return banka;
  134. }
  135.  
  136. static READ_HANDLER( gladiator_dsw1_r )
  137. {
  138.     int orig = readinputport(0); /* DSW1 */
  139. /*Reverse all bits for Input Port 0*/
  140. /*ie..Bit order is: 0,1,2,3,4,5,6,7*/
  141. return   ((orig&0x01)<<7) | ((orig&0x02)<<5)
  142.        | ((orig&0x04)<<3) | ((orig&0x08)<<1)
  143.        | ((orig&0x10)>>1) | ((orig&0x20)>>3)
  144.        | ((orig&0x40)>>5) | ((orig&0x80)>>7);;
  145. }
  146.  
  147. static READ_HANDLER( gladiator_dsw2_r )
  148. {
  149.     int orig = readinputport(1); /* DSW2 */
  150. /*Bits 2-7 are reversed for Input Port 1*/
  151. /*ie..Bit order is: 2,3,4,5,6,7,1,0*/
  152. return      (orig&0x01) | (orig&0x02)
  153.     | ((orig&0x04)<<5) | ((orig&0x08)<<3)
  154.     | ((orig&0x10)<<1) | ((orig&0x20)>>1)
  155.     | ((orig&0x40)>>3) | ((orig&0x80)>>5);
  156. }
  157.  
  158. static READ_HANDLER( gladiator_controll_r )
  159. {
  160.     int coins = 0;
  161.  
  162.     if( readinputport(4) & 0xc0 ) coins = 0x80;
  163.     switch(offset)
  164.     {
  165.     case 0x01: /* start button , coins */
  166.         return readinputport(3) | coins;
  167.     case 0x02: /* Player 1 Controller , coins */
  168.         return readinputport(5) | coins;
  169.     case 0x04: /* Player 2 Controller , coins */
  170.         return readinputport(6) | coins;
  171.     }
  172.     /* unknown */
  173.     return 0;
  174. }
  175.  
  176. static READ_HANDLER( gladiator_button3_r )
  177. {
  178.     switch(offset)
  179.     {
  180.     case 0x01: /* button 3 */
  181.         return readinputport(7);
  182.     }
  183.     /* unknown */
  184.     return 0;
  185. }
  186.  
  187. static struct TAITO8741interface gsword_8741interface=
  188. {
  189.     4,         /* 4 chips */
  190.     {TAITO8741_MASTER,TAITO8741_SLAVE,TAITO8741_PORT,TAITO8741_PORT},/* program mode */
  191.     {1,0,0,0},    /* serial port connection */
  192.     {gladiator_dsw1_r,gladiator_dsw2_r,gladiator_button3_r,gladiator_controll_r}    /* port handler */
  193. };
  194.  
  195. static void gladiator_machine_init(void)
  196. {
  197.     TAITO8741_start(&gsword_8741interface);
  198.     /* 6809 bank memory set */
  199.     {
  200.         unsigned char *RAM = memory_region(REGION_CPU3);
  201.         cpu_setbank(3,&RAM[0x10000]);
  202.         cpu_setbank(4,&RAM[0x18000]);
  203.         cpu_setbank(5,&RAM[0x20000]);
  204.     }
  205. }
  206.  
  207. #if 1
  208. /* !!!!! patch to IRQ timming for 2nd CPU !!!!! */
  209. WRITE_HANDLER( gladiatr_irq_patch_w )
  210. {
  211.     cpu_cause_interrupt(1,Z80_INT_REQ);
  212. }
  213. #endif
  214.  
  215. /* YM2203 port A handler (input) */
  216. static READ_HANDLER( gladiator_dsw3_r )
  217. {
  218.     return input_port_2_r(offset)^0xff;
  219. }
  220. /* YM2203 port B handler (output) */
  221. static WRITE_HANDLER( gladiator_int_control_w )
  222. {
  223.     /* bit 7   : SSRST = sound reset ? */
  224.     /* bit 6-1 : N.C.                  */
  225.     /* bit 0   : ??                    */
  226. }
  227. /* YM2203 IRQ */
  228. static void gladiator_ym_irq(int irq)
  229. {
  230.     /* NMI IRQ is not used by gladiator sound program */
  231.     cpu_set_nmi_line(1,irq ? ASSERT_LINE : CLEAR_LINE);
  232.     /* cpu_cause_interrupt(1,Z80_NMI_INT); */
  233. }
  234.  
  235. /*Sound Functions*/
  236. static WRITE_HANDLER( glad_adpcm_w )
  237. {
  238.     unsigned char *RAM = memory_region(REGION_CPU3);
  239.     /* bit6 = bank offset */
  240.     int bankoffset = data&0x40 ? 0x4000 : 0;
  241.     cpu_setbank(3,&RAM[0x10000+bankoffset]);
  242.     cpu_setbank(4,&RAM[0x18000+bankoffset]);
  243.     cpu_setbank(5,&RAM[0x20000+bankoffset]);
  244.  
  245.     MSM5205_data_w(0,data);         /* bit0..3  */
  246.     MSM5205_reset_w(0,(data>>5)&1); /* bit 5    */
  247.     MSM5205_vclk_w (0,(data>>4)&1); /* bit4     */
  248. }
  249.  
  250. static WRITE_HANDLER( glad_cpu_sound_command_w )
  251. {
  252.     soundlatch_w(0,data);
  253.     cpu_set_nmi_line(2,ASSERT_LINE);
  254. }
  255.  
  256. static READ_HANDLER( glad_cpu_sound_command_r )
  257. {
  258.     cpu_set_nmi_line(2,CLEAR_LINE);
  259.     return soundlatch_r(0);
  260. }
  261.  
  262.  
  263.  
  264. static unsigned char *nvram;
  265. static size_t nvram_size;
  266.  
  267. static void nvram_handler(void *file,int read_or_write)
  268. {
  269.     if (read_or_write)
  270.         osd_fwrite(file,nvram,nvram_size);
  271.     else
  272.     {
  273.         if (file)
  274.             osd_fread(file,nvram,nvram_size);
  275.         else
  276.             memset(nvram,0,nvram_size);
  277.     }
  278. }
  279.  
  280.  
  281.  
  282. static struct MemoryReadAddress readmem[] =
  283. {
  284.     { 0x0000, 0x5fff, MRA_ROM },
  285.     { 0x6000, 0x7fff, MRA_BANK1},
  286.     { 0x8000, 0xbfff, MRA_BANK2},
  287.     { 0xc000, 0xcbff, MRA_RAM },
  288.     { 0xcc00, 0xcfff, gladiatr_video_registers_r },
  289.     { 0xd000, 0xffff, MRA_RAM },
  290.     { -1 }    /* end of table */
  291. };
  292.  
  293. static struct MemoryWriteAddress writemem[] =
  294. {
  295.     { 0x0000, 0xbfff, MWA_ROM },
  296.     { 0xc000, 0xcbff, MWA_RAM, &spriteram },
  297.     { 0xcc00, 0xcfff, gladiatr_video_registers_w },
  298.     { 0xd000, 0xd1ff, gladiatr_paletteram_rg_w, &paletteram },
  299.     { 0xd200, 0xd3ff, MWA_RAM },
  300.     { 0xd400, 0xd5ff, gladiatr_paletteram_b_w, &paletteram_2 },
  301.     { 0xd600, 0xd7ff, MWA_RAM },
  302.     { 0xd800, 0xdfff, videoram_w, &videoram },
  303.     { 0xe000, 0xe7ff, colorram_w, &colorram },
  304.     { 0xe800, 0xefff, MWA_RAM, &gladiator_text },
  305.     { 0xf000, 0xf3ff, MWA_RAM, &nvram, &nvram_size }, /* battery backed RAM */
  306.     { 0xf400, 0xffff, MWA_RAM },
  307.     { -1 }    /* end of table */
  308. };
  309.  
  310. static struct MemoryReadAddress readmem_cpu2[] =
  311. {
  312.     { 0x0000, 0x3fff, MRA_ROM },
  313.     { 0x8000, 0x83ff, MRA_RAM },
  314.     { -1 }    /* end of table */
  315. };
  316.  
  317. static struct MemoryWriteAddress writemem_cpu2[] =
  318. {
  319.     { 0x0000, 0x3fff, MWA_ROM },
  320.     { 0x8000, 0x83ff, MWA_RAM },
  321.     { -1 }    /* end of table */
  322. };
  323.  
  324. static struct MemoryReadAddress sound_readmem[] =
  325. {
  326.     { 0x2000, 0x2fff, glad_cpu_sound_command_r },
  327.     { 0x4000, 0x7fff, MRA_BANK3 }, /* BANKED ROM */
  328.     { 0x8000, 0xbfff, MRA_BANK4 }, /* BANKED ROM */
  329.     { 0xc000, 0xffff, MRA_BANK5 }, /* BANKED ROM */
  330.     { -1 }  /* end of table */
  331. };
  332.  
  333. static struct MemoryWriteAddress sound_writemem[] =
  334. {
  335.     { 0x1000, 0x1fff, glad_adpcm_w },
  336.     { -1 }  /* end of table */
  337. };
  338.  
  339.  
  340. static struct IOReadPort readport[] =
  341. {
  342.     { 0x02, 0x02, gladiatr_bankswitch_r },
  343.     { 0x9e, 0x9f, TAITO8741_0_r },
  344.     { -1 }    /* end of table */
  345. };
  346.  
  347. static struct IOWritePort writeport[] =
  348. {
  349.     { 0x01, 0x01, gladiatr_spritebank_w},
  350.     { 0x02, 0x02, gladiatr_bankswitch_w},
  351.     { 0x04, 0x04, gladiatr_irq_patch_w}, /* !!! patch to 2nd CPU IRQ !!! */
  352.     { 0x9e, 0x9f, TAITO8741_0_w },
  353.     { 0xbf, 0xbf, IORP_NOP },
  354.     { -1 }    /* end of table */
  355. };
  356.  
  357. static struct IOReadPort readport_cpu2[] =
  358. {
  359.     { 0x00, 0x00, YM2203_status_port_0_r },
  360.     { 0x01, 0x01, YM2203_read_port_0_r },
  361.     { 0x20, 0x21, TAITO8741_1_r },
  362.     { 0x40, 0x40, IOWP_NOP },
  363.     { 0x60, 0x61, TAITO8741_2_r },
  364.     { 0x80, 0x81, TAITO8741_3_r },
  365.     { -1 }    /* end of table */
  366. };
  367.  
  368. static struct IOWritePort writeport_cpu2[] =
  369. {
  370.     { 0x00, 0x00, YM2203_control_port_0_w },
  371.     { 0x01, 0x01, YM2203_write_port_0_w },
  372.     { 0x20, 0x21, TAITO8741_1_w },
  373.     { 0x60, 0x61, TAITO8741_2_w },
  374.     { 0x80, 0x81, TAITO8741_3_w },
  375. /*    { 0x40, 0x40, glad_sh_irq_clr }, */
  376.     { 0xe0, 0xe0, glad_cpu_sound_command_w },
  377.     { -1 }    /* end of table */
  378. };
  379.  
  380. INPUT_PORTS_START( gladiatr )
  381.     PORT_START        /* DSW1 (8741-0 parallel port)*/
  382.     PORT_DIPNAME( 0x03, 0x01, DEF_STR( Difficulty ) )
  383.     PORT_DIPSETTING(    0x00, "Easy" )
  384.     PORT_DIPSETTING(    0x01, "Medium" )
  385.     PORT_DIPSETTING(    0x02, "Hard" )
  386.     PORT_DIPSETTING(    0x03, "Hardest" )
  387.     PORT_DIPNAME( 0x04, 0x04, "After 4 Stages" )
  388.     PORT_DIPSETTING(    0x04, "Continues" )
  389.     PORT_DIPSETTING(    0x00, "Ends" )
  390.     PORT_DIPNAME( 0x08, 0x00, DEF_STR( Bonus_Life ) )   /*NOTE: Actual manual has these settings reversed(typo?)! */
  391.     PORT_DIPSETTING(    0x00, "Only at 100000" )
  392.     PORT_DIPSETTING(    0x08, "Every 100000" )
  393.     PORT_DIPNAME( 0x30, 0x20, DEF_STR( Lives ) )
  394.     PORT_DIPSETTING(    0x00, "1" )
  395.     PORT_DIPSETTING(    0x10, "2" )
  396.     PORT_DIPSETTING(    0x20, "3" )
  397.     PORT_DIPSETTING(    0x30, "4" )
  398.     PORT_DIPNAME( 0x40, 0x00, "Allow Continue" )
  399.     PORT_DIPSETTING(    0x40, DEF_STR( No ) )
  400.     PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
  401.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) )
  402.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  403.     PORT_DIPSETTING(    0x80, DEF_STR( On ) )
  404.  
  405.     PORT_START      /* DSW2  (8741-1 parallel port) - Dips 6 Unused */
  406.     PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coin_A ) )
  407.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  408.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
  409.     PORT_DIPSETTING(    0x02, DEF_STR( 1C_4C ) )
  410.     PORT_DIPSETTING(    0x03, DEF_STR( 1C_5C ) )
  411.     PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Coin_B ) )
  412.     PORT_DIPSETTING(    0x0c, DEF_STR( 5C_1C ) )
  413.     PORT_DIPSETTING(    0x08, DEF_STR( 4C_1C ) )
  414.     PORT_DIPSETTING(    0x04, DEF_STR( 3C_1C ) )
  415.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
  416.     PORT_DIPNAME( 0x10, 0x00, DEF_STR( Free_Play ) )
  417.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  418.     PORT_DIPSETTING(    0x10, DEF_STR( On ) )
  419.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Cabinet ) )
  420.     PORT_DIPSETTING(    0x40, DEF_STR( Upright ) )
  421.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  422.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Flip_Screen ) )
  423.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  424.     PORT_DIPSETTING(    0x80, DEF_STR( On ) )
  425.  
  426.     PORT_START      /* DSW3 (YM2203 port B) - Dips 5,6,7 Unused */
  427.     PORT_BITX(    0x01, 0x00, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Invulnerability", IP_KEY_NONE, IP_JOY_NONE )
  428.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  429.     PORT_DIPSETTING(    0x01, DEF_STR( On ) )
  430.     PORT_DIPNAME( 0x02, 0x00, "Memory Backup" )
  431.     PORT_DIPSETTING(    0x00, "Normal" )
  432.     PORT_DIPSETTING(    0x02, "Clear" )
  433.     PORT_DIPNAME( 0x0c, 0x00, "Starting Stage" )
  434.     PORT_DIPSETTING(    0x00, "1" )
  435.     PORT_DIPSETTING(    0x04, "2" )
  436.     PORT_DIPSETTING(    0x08, "3" )
  437.     PORT_DIPSETTING(    0x0c, "4" )
  438.     PORT_SERVICE( 0x80, IP_ACTIVE_HIGH )
  439.  
  440.     PORT_START    /* IN0 (8741-3 parallel port 1) */
  441.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
  442.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
  443.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  444.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  445.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  446.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  447.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  448.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  449.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* COINS */
  450.  
  451.     PORT_START    /* COINS (8741-3 parallel port bit7) */
  452.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
  453.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
  454.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  455.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  456.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  457.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  458.     PORT_BIT_IMPULSE( 0x40, IP_ACTIVE_HIGH, IPT_COIN1, 1 )
  459.     PORT_BIT_IMPULSE( 0x80, IP_ACTIVE_HIGH, IPT_COIN2, 1 )
  460.  
  461.     PORT_START    /* IN1 (8741-3 parallel port 2) */
  462.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  463.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_8WAY )
  464.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_8WAY )
  465.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_8WAY )
  466.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 )
  467.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 )
  468.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  469.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* COINS */
  470.  
  471.     PORT_START    /* IN2 (8741-3 parallel port 4) */
  472.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  473.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
  474.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
  475.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
  476.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL )
  477.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 | IPF_COCKTAIL )
  478.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 | IPF_COCKTAIL )
  479.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  480.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* COINS */
  481.  
  482.     PORT_START    /* IN3 (8741-2 parallel port 1) */
  483.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3 )
  484.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 | IPF_COCKTAIL )
  485.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  486.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  487.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  488.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  489.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  490.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  491. INPUT_PORTS_END
  492.  
  493. /*******************************************************************/
  494.  
  495. static struct GfxLayout gladiator_text_layout  =   /* gfxset 0 */
  496. {
  497.     8,8,    /* 8*8 tiles */
  498.     1024,    /* number of tiles */
  499.     1,        /* bits per pixel */
  500.     { 0 },    /* plane offsets */
  501.     { 0,1,2,3,4,5,6,7 }, /* x offsets */
  502.     { 0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8 }, /* y offsets */
  503.     64 /* offset to next tile */
  504. };
  505.  
  506. /*******************************************************************/
  507.  
  508. #define DEFINE_LAYOUT( NAME,P0,P1,P2) static struct GfxLayout NAME = { \
  509.     8,8,512,3, \
  510.     { P0, P1, P2}, \
  511.     { 0,1,2,3,64+0,64+1,64+2,64+3 }, \
  512.     { 0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8 }, \
  513.     128 \
  514. };
  515.  
  516. DEFINE_LAYOUT( gladiator_tile0, 4,            0x08000*8, 0x08000*8+4 )
  517. DEFINE_LAYOUT( gladiator_tile1, 0,            0x0A000*8, 0x0A000*8+4 )
  518. DEFINE_LAYOUT( gladiator_tile2, 4+0x2000*8, 0x10000*8, 0x10000*8+4 )
  519. DEFINE_LAYOUT( gladiator_tile3, 0+0x2000*8, 0x12000*8, 0x12000*8+4 )
  520. DEFINE_LAYOUT( gladiator_tile4, 4+0x4000*8, 0x0C000*8, 0x0C000*8+4 )
  521. DEFINE_LAYOUT( gladiator_tile5, 0+0x4000*8, 0x0E000*8, 0x0E000*8+4 )
  522. DEFINE_LAYOUT( gladiator_tile6, 4+0x6000*8, 0x14000*8, 0x14000*8+4 )
  523. DEFINE_LAYOUT( gladiator_tile7, 0+0x6000*8, 0x16000*8, 0x16000*8+4 )
  524. DEFINE_LAYOUT( gladiator_tileA, 4+0x2000*8, 0x0A000*8, 0x0A000*8+4 )
  525. DEFINE_LAYOUT( gladiator_tileB, 0,            0x10000*8, 0x10000*8+4 )
  526. DEFINE_LAYOUT( gladiator_tileC, 4+0x6000*8, 0x0E000*8, 0x0E000*8+4 )
  527. DEFINE_LAYOUT( gladiator_tileD, 0+0x4000*8, 0x14000*8, 0x14000*8+4 )
  528.  
  529. static struct GfxDecodeInfo gfxdecodeinfo[] =
  530. {
  531.     /* monochrome text layer */
  532.     { REGION_GFX1, 0x00000, &gladiator_text_layout, 512, 1 },
  533.  
  534.     /* background tiles */
  535.     { REGION_GFX2, 0x00000, &gladiator_tile0, 0, 64 },
  536.     { REGION_GFX2, 0x00000, &gladiator_tile1, 0, 64 },
  537.     { REGION_GFX2, 0x00000, &gladiator_tile2, 0, 64 },
  538.     { REGION_GFX2, 0x00000, &gladiator_tile3, 0, 64 },
  539.     { REGION_GFX2, 0x00000, &gladiator_tile4, 0, 64 },
  540.     { REGION_GFX2, 0x00000, &gladiator_tile5, 0, 64 },
  541.     { REGION_GFX2, 0x00000, &gladiator_tile6, 0, 64 },
  542.     { REGION_GFX2, 0x00000, &gladiator_tile7, 0, 64 },
  543.  
  544.     /* sprites */
  545.     { REGION_GFX3, 0x00000, &gladiator_tile0, 0, 64 },
  546.     { REGION_GFX3, 0x00000, &gladiator_tileB, 0, 64 },
  547.     { REGION_GFX3, 0x00000, &gladiator_tileA, 0, 64 },
  548.     { REGION_GFX3, 0x00000, &gladiator_tile3, 0, 64 }, /* "GLAD..." */
  549.     { REGION_GFX3, 0x18000, &gladiator_tile0, 0, 64 },
  550.     { REGION_GFX3, 0x18000, &gladiator_tileB, 0, 64 },
  551.     { REGION_GFX3, 0x18000, &gladiator_tileA, 0, 64 },
  552.     { REGION_GFX3, 0x18000, &gladiator_tile3, 0, 64 }, /* ...DIATOR */
  553.     { REGION_GFX3, 0x18000, &gladiator_tile4, 0, 64 },
  554.     { REGION_GFX3, 0x18000, &gladiator_tileD, 0, 64 },
  555.     { REGION_GFX3, 0x18000, &gladiator_tileC, 0, 64 },
  556.     { REGION_GFX3, 0x18000, &gladiator_tile7, 0, 64 },
  557.  
  558.     { -1 } /* end of array */
  559. };
  560.  
  561. #undef DEFINE_LAYOUT
  562.  
  563.  
  564.  
  565. static struct YM2203interface ym2203_interface =
  566. {
  567.     1,        /* 1 chip */
  568.     1500000,    /* 1.5 MHz? */
  569.     { YM2203_VOL(25,25) },
  570.     { 0 },
  571.     { gladiator_dsw3_r },         /* port B read */
  572.     { gladiator_int_control_w }, /* port A write */
  573.     { 0 },
  574.     { gladiator_ym_irq }          /* NMI request for 2nd cpu */
  575. };
  576.  
  577. static struct MSM5205interface msm5205_interface =
  578. {
  579.     1,                    /* 1 chip             */
  580.     455000,                /* 455KHz ??          */
  581.     { 0 },                /* interrupt function */
  582.     { MSM5205_SEX_4B},    /* vclk input mode    */
  583.     { 60 }
  584. };
  585.  
  586.  
  587.  
  588. static struct MachineDriver machine_driver_gladiatr =
  589. {
  590.     {
  591.         {
  592.             CPU_Z80,
  593.             6000000, /* 6 MHz? */
  594.             readmem,writemem,readport,writeport,
  595.             interrupt,1
  596.         },
  597.         {
  598.             CPU_Z80,
  599.             3000000, /* 3 MHz? */
  600.             readmem_cpu2,writemem_cpu2,readport_cpu2,writeport_cpu2,
  601.             ignore_interrupt,1
  602.  
  603.         },
  604.         {
  605.             CPU_M6809 | CPU_AUDIO_CPU,
  606.             750000, /* 750 kHz (hand tuned) */
  607.             sound_readmem,sound_writemem,0,0,
  608.             ignore_interrupt,0    /* NMIs are generated by the main CPU */
  609.         }
  610.     },
  611.     60, DEFAULT_60HZ_VBLANK_DURATION, /* fps, vblank duration */
  612.     10,    /* interleaving */
  613.     gladiator_machine_init,
  614.  
  615.     /* video hardware */
  616.     32*8, 32*8, { 0, 255, 0+16, 255-16 },
  617.  
  618.     gfxdecodeinfo,
  619.     512+2, 512+2,
  620.     0,
  621.  
  622.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
  623.     0,
  624.     gladiatr_vh_start,
  625.     gladiatr_vh_stop,
  626.     gladiatr_vh_screenrefresh,
  627.  
  628.     /* sound hardware */
  629.     0, 0,    0, 0,
  630.     {
  631.         {
  632.             SOUND_YM2203,
  633.             &ym2203_interface
  634.         },
  635.         {
  636.             SOUND_MSM5205,
  637.             &msm5205_interface
  638.         }
  639.     },
  640.  
  641.     nvram_handler
  642. };
  643.  
  644. /***************************************************************************
  645.  
  646.   Game driver(s)
  647.  
  648. ***************************************************************************/
  649.  
  650. ROM_START( gladiatr )
  651.     ROM_REGION( 0x1c000, REGION_CPU1 )
  652.     ROM_LOAD( "qb0-5",          0x00000, 0x4000, 0x25b19efb )
  653.     ROM_LOAD( "qb0-4",          0x04000, 0x2000, 0x347ec794 )
  654.     ROM_LOAD( "qb0-1",          0x10000, 0x4000, 0x040c9839 )
  655.     ROM_LOAD( "qc0-3",          0x14000, 0x8000, 0x8d182326 )
  656.  
  657.     ROM_REGION( 0x10000, REGION_CPU2 ) /* Code for the 2nd CPU */
  658.     ROM_LOAD( "qb0-17",           0x0000, 0x4000, 0xe78be010 )
  659.  
  660.     ROM_REGION( 0x28000, REGION_CPU3 )  /* 6809 Code & ADPCM data */
  661.     ROM_LOAD( "qb0-20",         0x10000, 0x8000, 0x15916eda )
  662.     ROM_LOAD( "qb0-19",         0x18000, 0x8000, 0x79caa7ed )
  663.     ROM_LOAD( "qb0-18",         0x20000, 0x8000, 0xe9591260 )
  664.  
  665.     ROM_REGION( 0x02000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  666.     ROM_LOAD( "qc0-15",           0x00000, 0x2000, 0xa7efa340 ) /* (monochrome) */
  667.  
  668.     ROM_REGION( 0x18000, REGION_GFX2 | REGIONFLAG_DISPOSE )    /* tiles */
  669.     ROM_LOAD( "qb0-12",           0x00000, 0x8000, 0x0585d9ac ) /* plane 3 */
  670.     ROM_LOAD( "qb0-13",           0x08000, 0x8000, 0xa6bb797b ) /* planes 1,2 */
  671.     ROM_LOAD( "qb0-14",           0x10000, 0x8000, 0x85b71211 ) /* planes 1,2 */
  672.  
  673.     ROM_REGION( 0x30000, REGION_GFX3 | REGIONFLAG_DISPOSE )    /* sprites */
  674.     ROM_LOAD( "qc1-6",            0x00000, 0x4000, 0x651e6e44 ) /* plane 3 */
  675.     ROM_LOAD( "qc0-8",            0x08000, 0x4000, 0x1c7ffdad ) /* planes 1,2 */
  676.     ROM_LOAD( "qc1-9",            0x10000, 0x4000, 0x01043e03 ) /* planes 1,2 */
  677.     ROM_LOAD( "qc2-7",            0x18000, 0x8000, 0xc992c4f7 ) /* plane 3 */
  678.     ROM_LOAD( "qc1-10",           0x20000, 0x8000, 0x364cdb58 ) /* planes 1,2 */
  679.     ROM_LOAD( "qc2-11",           0x28000, 0x8000, 0xc9fecfff ) /* planes 1,2 */
  680. ROM_END
  681.  
  682. ROM_START( ogonsiro )
  683.     ROM_REGION( 0x1c000, REGION_CPU1 )
  684.     ROM_LOAD( "qb0-5",          0x00000, 0x4000, 0x25b19efb )
  685.     ROM_LOAD( "qb0-4",          0x04000, 0x2000, 0x347ec794 )
  686.     ROM_LOAD( "qb0-1",          0x10000, 0x4000, 0x040c9839 )
  687.     ROM_LOAD( "qb0_3",          0x14000, 0x8000, 0xd6a342e7 )
  688.  
  689.     ROM_REGION( 0x10000, REGION_CPU2 ) /* Code for the 2nd CPU */
  690.     ROM_LOAD( "qb0-17",           0x0000, 0x4000, 0xe78be010 )
  691.  
  692.     ROM_REGION( 0x28000, REGION_CPU3 )  /* 6809 Code & ADPCM data */
  693.     ROM_LOAD( "qb0-20",         0x10000, 0x8000, 0x15916eda )
  694.     ROM_LOAD( "qb0-19",         0x18000, 0x8000, 0x79caa7ed )
  695.     ROM_LOAD( "qb0-18",         0x20000, 0x8000, 0xe9591260 )
  696.  
  697.     ROM_REGION( 0x02000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  698.     ROM_LOAD( "qb0_15",           0x00000, 0x2000, 0x5e1332b8 ) /* (monochrome) */
  699.  
  700.     ROM_REGION( 0x18000, REGION_GFX2 | REGIONFLAG_DISPOSE )    /* tiles */
  701.     ROM_LOAD( "qb0-12",           0x00000, 0x8000, 0x0585d9ac ) /* plane 3 */
  702.     ROM_LOAD( "qb0-13",           0x08000, 0x8000, 0xa6bb797b ) /* planes 1,2 */
  703.     ROM_LOAD( "qb0-14",           0x10000, 0x8000, 0x85b71211 ) /* planes 1,2 */
  704.  
  705.     ROM_REGION( 0x30000, REGION_GFX3 | REGIONFLAG_DISPOSE )    /* sprites */
  706.     ROM_LOAD( "qb0_6",            0x00000, 0x4000, 0x1a2bc769 ) /* plane 3 */
  707.     ROM_LOAD( "qc0-8",            0x08000, 0x4000, 0x1c7ffdad ) /* planes 1,2 */
  708.     ROM_LOAD( "qb0_9",            0x10000, 0x4000, 0x38f5152d ) /* planes 1,2 */
  709.     ROM_LOAD( "qb0_7",            0x18000, 0x8000, 0x4b677bd9 ) /* plane 3 */
  710.     ROM_LOAD( "qb0_10",           0x20000, 0x8000, 0x87ab6cc4 ) /* planes 1,2 */
  711.     ROM_LOAD( "qb0_11",           0x28000, 0x8000, 0x25eaa4ff ) /* planes 1,2 */
  712. ROM_END
  713.  
  714.  
  715.  
  716. GAMEX( 1986, gladiatr, 0,        gladiatr, gladiatr, 0, ROT0, "Taito America Corporation", "Gladiator (US)", GAME_NO_COCKTAIL )
  717. GAMEX( 1986, ogonsiro, gladiatr, gladiatr, gladiatr, 0, ROT0, "Taito Corporation", "Ohgon no Siro (Japan)", GAME_NO_COCKTAIL )
  718.